[LLVMbugs] [Bug 6972] New: virtual derived constructor with "throw()" is seen as too lax when templates are involved

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 28 20:33:31 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=6972

           Summary: virtual derived constructor with "throw()" is seen as
                    too lax when templates are involved
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: peter.goodman at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=4764)
 --> (http://llvm.org/bugs/attachment.cgi?id=4764)
Code used to test this problem.

I have 3 classes. The first, Foo, is a template with two parameters. The second
is a template class, Bar, with one parameter T that extends Foo<T,T>. The third
class, Baz, extends Bar<int> where int can be replaced with concrete type. All
classes have virtual destructors with throw() set. When attempting to compile
this, I am issued the following error:

--
    ./clang-test-throw-destructor.cpp:16:13: error: exception specification of
    overriding function is more lax than base version
        virtual ~Baz(void) throw() { }
                ^
    ./clang-test-throw-destructor.cpp:11:13: note: overridden virtual function
    is here
        virtual ~Bar(void) throw() { }
                ^
    1 error generated.
--


I *think* that this is incorrect as all three destructors have the same
exception specification.

Specs:
clang version 1.5 (trunk 101948)
Apple Model Id: MacBookPro5,5
Processor: Intel Core 2 Duo
OS: Mac OS X 10.6.3 (10D573)
Kernel Version: Darwin 10.3.0
Xcode version: 3.2.1 (1613)
Compiler flags: -O0 -g -pedantic -pedantic-errors -Wall -Werror -Wextra -ansi

Attached is the code that I tested with, and that the above errors reported.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list