Project

General

Profile

Actions

Bug #3343

closed

Explicit specialization of DummyClientFace::receive<lp::Nack> relies on undefined behavior

Added by Davide Pesavento over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Utils
Target version:
Start date:
11/17/2015
Due date:
% Done:

100%

Estimated time:
0.50 h

Description

The explicit specialization of DummyClientFace::receive for lp::Nack appears only in dummy-client-face.cpp. Users of the class will presumably include the corresponding header file instead, which does not declare any explicit specializations for the function template, thus the compiler will implicitly instantiate the "generic" version. This invokes undefined behavior according to the ISO C++ standard (ยง14.7.3):

If a template, a member template or a member of a class template is explicitly specialized then that specialization
shall be declared before the first use of that specialization that would cause an implicit instantiation
to take place, in every translation unit in which such a use occurs; no diagnostic is required.

Actions #1

Updated by Davide Pesavento over 8 years ago

  • Description updated (diff)
Actions #2

Updated by Davide Pesavento over 8 years ago

Obviously the solution is to declare the explicit specialization in dummy-client-face.hpp

Actions #3

Updated by Junxiao Shi over 8 years ago

  • Assignee set to Eric Newberry
  • Target version set to v0.4
  • Estimated time set to 0.50 h

I agree with note-2 solution.

Actions #4

Updated by Eric Newberry over 8 years ago

  • Status changed from New to In Progress
Actions #5

Updated by Eric Newberry over 8 years ago

  • Status changed from In Progress to Code review
Actions #6

Updated by Davide Pesavento over 8 years ago

  • Status changed from Code review to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF